package com.sali.asyncollection.service.impl;

import com.sali.asyncollection.model.BannerDTO;
import com.sali.asyncollection.model.BannerParam;
import com.sali.asyncollection.model.BaseRspDTO;
import com.sali.asyncollection.service.IBannerService;
import com.sali.asyncollection.service.IBaseTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/15 20:59.
 * @version: 1.0
 */
@Service
public class BannerStrategyTask implements IBaseTask {

    @Autowired
    private IBannerService bannerService;

    @Override
    public String getTaskType() {
        return "bannerDTO";
    }

    @Override
    public BaseRspDTO<Object> execute(String req) {
        BannerParam bannerParam = new BannerParam(req);
        BannerDTO bannerDTO = bannerService.queryBannerInfo(bannerParam);
        BaseRspDTO<Object> bannerBaseRspDTO = new BaseRspDTO<Object>();
        bannerBaseRspDTO.setKey(getTaskType());
        bannerBaseRspDTO.setData(bannerDTO);
        return bannerBaseRspDTO;
    }
}
